<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 *
 * PARAMS:
 *    assign      - assign to variable - otherwirse to 'articles'
 *    article     - select comments for given article
 *    limit       - limit articles
 *    assignpages - assign pages array to variable
 */

require_once(ROOT . LIBRARY . '/comments.class.inc');

function smarty_function_meccano_comments($params, &$smarty)
{
   foreach($params AS $k=>$value)
   {
      $$k = $value;
   }

   $COMMENTS = new Comments();

   $data = FALSE;
   if(!empty($article)) $data = $COMMENTS->getComments($article);

   if(empty($assign)) $assign = 'comments';
   $smarty->assign('comments', $data);
}


